#include <iostream>
#include <ctime>

#define DBG_LEVEL 0
#define INF_LEVEL 1
#define ERR_LEVEL 2
#define DEFULT_LEVEL DBG_LEVEL

#define LOG(lev_str, level, format, ...)                                                                   \
    {                                                                                                      \
        if (level >= DEFULT_LEVEL)                                                                         \
        {                                                                                                  \
            time_t t = time(nullptr);                                                                      \
            struct tm *ptm = localtime(&t);                                                                \
            char time_str[32];                                                                             \
            strftime(time_str, 31, "%H:%M:%S", ptm);                                                       \
            printf("[%s][%s][%s:%d]\t" format "\n", lev_str, time_str, __FILE__, __LINE__, ##__VA_ARGS__); \
        }                                                                                                  \
    }
#define DBG_LOG(format, ...) LOG("DBG", DBG_LEVEL, format, DBG_LEVEL)
#define INF_LOG(format, ...) LOG("INF", INF_LEVEL, format, INF_LEVEL)
#define ERR_LOG(format, ...) LOG("ERR", ERR_LEVEL, format, ERR_LEVEL)

int main()
{
    DBG_LOG("hello wrold");
    INF_LOG("hello wrold");
    ERR_LOG("hello wrold");
    return 0;
}